$(document).ready(function() {
	HidePanel();
});

$(function() {
	var tabs = $("#tabs").tabs({
		collapsible : false,
		select : function(e, ui) {

			var text = $(ui.tab).text();
			//alert("-" + text + "-");
			if (text == "Doanh Thu") {
				//alert(text);
				$("#panelSanPhamTop").addClass("hidden");
				$("#panelDoanhThu").removeClass("hidden");
			}
			else {
				$("#panelDoanhThu").addClass("hidden");
				$("#panelSanPhamTop").removeClass("hidden");
			}

		}
		//fx: { opacity: "toggle" }
	});

	$("#txtTuNgay, #txtDenNgay").datepicker({
		showWeek : true,
		firstDay : 1,
		numberOfMonths : 3,
		changeMonth : true,
		showButtonPanel : true,
		dateFormat : "dd/mm/yy" // "(" + "dd/mm/yy" +")" + "DD, d MM, yy"
	});
});
// ------------------------------------
function ShowPanelDoiTuong() {

	var lstDoiTuong = document.getElementsByName('doiTuongThongKe');
	for ( var i = 0; i < lstDoiTuong.length; i++) {
		if (lstDoiTuong[i].checked) {
			// alert(lstDoiTuong[i].value + "-" + lstDoiTuong[i].id);
			if (lstDoiTuong[i].value == "SanPham")
				ShowPanelSanPham();
			if (lstDoiTuong[i].value == "NguoiDung")
				ShowPanelNguoiDung();
			if (lstDoiTuong[i].value == "DoTuoi")
				ShowPanelDoTuoi();
		}
	}
};
function HidePanel() {
	document.getElementById("panelSanPham").style.display = "none";
	document.getElementById("panelNguoiDung").style.display = "none";
	document.getElementById("panelDoTuoi").style.display = "none";

	document.getElementById("panelThoiGian").style.display = "none";
	document.getElementById("panelKhoangThoiGian").style.display = "none";
	document.getElementById("panelMocThoiGian").style.display = "none";

}
function ShowPanelSanPham() {
	document.getElementById("panelSanPham").style.display = "block";
	document.getElementById("panelThoiGian").style.display = "block";
	document.getElementById("panelNguoiDung").style.display = "none";
	document.getElementById("panelDoTuoi").style.display = "none";
}
function ShowPanelNguoiDung() {
	document.getElementById("panelSanPham").style.display = "none";
	document.getElementById("panelThoiGian").style.display = "block";
	document.getElementById("panelNguoiDung").style.display = "block";
	document.getElementById("panelDoTuoi").style.display = "none";
}
function ShowPanelDoTuoi() {
	document.getElementById("panelSanPham").style.display = "none";
	document.getElementById("panelThoiGian").style.display = "block";
	document.getElementById("panelNguoiDung").style.display = "none";
	document.getElementById("panelDoTuoi").style.display = "block";
}
// -----------------------------------------
function ShowPanelChonThoiGian() {

	var lstThoiGian = document.getElementsByName('groupThoiGian');
	for ( var i = 0; i < lstThoiGian.length; i++) {
		if (lstThoiGian[i].checked) {
			// alert(lstThoiGian[i].value + "-" + lstThoiGian[i].id);
			if (lstThoiGian[i].value == "KhoangThoiGian")
				ShowPanelKhoangThoiGian();
			if (lstThoiGian[i].value == "MocThoiGian")
				ShowPanelMocThoiGian();
		}
	}
};

function ShowPanelKhoangThoiGian() {
	document.getElementById("panelMocThoiGian").style.display = "none";
	document.getElementById("panelKhoangThoiGian").style.display = "block";
};

function ShowPanelMocThoiGian() {
	document.getElementById("panelKhoangThoiGian").style.display = "none";
	document.getElementById("panelMocThoiGian").style.display = "block";
};

function ShowHidePanelSanPham() {
	if (document.getElementById("tableContentSanPham").style.display != "none")
		document.getElementById("tableContentSanPham").style.display = "none";
	else
		document.getElementById("tableContentSanPham").style.display = "block";
}
function ShowHidePanelNguoiDung() {
	if (document.getElementById("tableContentNguoiDung").style.display != "none")
		document.getElementById("tableContentNguoiDung").style.display = "none";
	else
		document.getElementById("tableContentNguoiDung").style.display = "block";
}
function ShowHidePanelDoTuoi() {
	if (document.getElementById("tableContentDoTuoi").style.display != "none")
		document.getElementById("tableContentDoTuoi").style.display = "none";
	else
		document.getElementById("tableContentDoTuoi").style.display = "block";
}